package com.woniuxy.controller.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Data
public class AccountDto implements UserDetails {
    private static final long serialVersionUID = 1L;

    private Integer id;

    private String account;

    private String accountName;

    private String password;

    private String accountPhone;

    private String accountEmail;

    private String accountTouXin;

    private Integer state;

    private List<String> roles= new ArrayList<>();

    private List<GrantedAuthority> authorityRoles= new ArrayList<>();

    public void initRolse(){
        for (String role : roles) {
            authorityRoles.add(()->role);
        }
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getUsername() {
        return account;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
